clear all
cap close
set more off

cd ".\Data_Program\Econdata"

use sf12010countydistancemiles,clear   // NBER distance

merge 1:1 county1 county2 using sci   // BCKSW sci
keep if _merge==3
drop _merge

keep if county1==17031 // Cook County

gsort county1 -sci
gen nb = 1 if mi<=200
replace nb=2 if _n<=200

* merge with Census geo data
rename county2 county 
merge 1:1 county using countygeo.dta
drop if _merge==1
drop _merge

replace nb=0 if nb==.
la define nb 1 "GCMs"

grmap, activate
spset, modify shpfile(usacounties_shp)

grmap nb, clmethod(custom) clbreaks(0 0.9 1 2) ndfcolor(none) ndocolor(none) title("") legend(symy(*2) symx(*2) size(*1.25) position(7)) legorder(lohi) legend(order(4 "SCMs: Counties socially most connected to Cook" 3 "GCMs: Counties within 200 miles of Cook") size(4.3)) 
